from Deepmind WaveNet paper:
$$ f(x_t) = \mathrm{sign}(x_t) \frac{\mathrm{ln}(1 + \mu |X_t|)}{\mathrm{ln}(1+\mu)} $$
In [8]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
In [11]:
F = lambda u: lambda x_t : np.sign(x_t) * np.log(1 + u * np.abs(x_t)) / np.log(1 + u)
In [20]:
xs = np.linspace(-100, 100)
ys = list(map(F(1.0), xs))
plt.plot(xs, ys)
plt.title('$\mu$-law companding transformation', fontsize=16)
Out[20]:
In [22]:
log_x = list(map(np.log, xs))
plt.plot(xs, log_x)
Out[22]:
In [33]:
xs = np.linspace(-5, 5)
tanh_x = list(map(np.tanh, xs))
plt.plot(xs, np.real(tanh_x))
plt.plot(xs, np.imag(tanh_x))
Out[33]:
In [ ]: